# Contributor: Duncan Bellamy <dunk@denkimushi.com>
# Maintainer: Duncan Bellamy <dunk@denkimushi.com>
pkgname=qrupdate
pkgver=1.1.5
pkgrel=1
pkgdesc="Fork of the qrupdate library for future maintenance"
url="https://gitlab.mpi-magdeburg.mpg.de/koehlerm/qrupdate-ng"
arch="all"
license="GPL-3.0-only"
makedepends="cmake lapack-dev gfortran openblas-dev"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://gitlab.mpi-magdeburg.mpg.de/koehlerm/qrupdate-ng/-/archive/v$pkgver.tar.gz"
builddir="$srcdir/$pkgname-ng-v$pkgver-279971db6b140b663c71b1e205d80e2795558388"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		$CMAKE_CROSSOPTS .
	cmake --build build
}

check() {
	CTEST_OUTPUT_ON_FAILURE=1 ctest --test-dir build -E test_tchinx
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
528361c57f923ac0034a81b327dd0134fd0d4947dc51c9ff7d107b1b28feab66915b808a7db391785d97cf846cde4ba2b5f4bd1b495b96f5e8c8d16e4e651dc8  qrupdate-1.1.5.tar.gz
"
